using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SysFrame.Message
{
    /// <summary>
    /// 基础框架MESSAGE基类
    /// </summary>
    public class MsBase
    {

        private object _obj1;//备用1
        private object _obj2;//备用2
        private string _typecode1;//分类1
        private string _typecode2;//分类2


        /// <summary>
        /// 分类2
        /// </summary>	
        public string typecode2
        {
            get { return _typecode2; }
            set { _typecode2 = value; }
        }

        /// <summary>
        /// 分类1
        /// </summary>	
        public string typecode1
        {
            get { return _typecode1==""? "007001": _typecode1; }
            set { _typecode1 = value; }
        }


        /// <summary>
        /// 备用2
        /// </summary>	
        public object obj2
        {
            get { return _obj2; }
            set { _obj2 = value; }
        }

        /// <summary>
        /// 备用1
        /// </summary>
        public object obj1
        {
            get { return _obj1; }
            set { _obj1 = value; }
        }


        /// <summary>
        /// Json
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static T parse<T>(JObject data)
        {
            T ms = (T)data.ToObject(typeof(T));
            return ms;
        }

        /// <summary>
        /// JObject.FromObject
        /// </summary>
        /// <returns></returns>
        public override  string ToString() {
            return JObject.FromObject(this).ToString();
        }
    }
}
